<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
cfc('core')->checklogin();
$params=array(
	'from_type'=>1,
);
$this->model('model')->checkuser(0,$params);
$return=array();
$return['item']=model('core/member')->detail($_SESSION['uid'],array('credit1','credit2','mobile','groupid','avatar','nickname'));
if($return['item']['groupid']){
	$return['item']['group']=pdo_getcolumn('core_member_groups',array('id'=>$return['item']['groupid'],'uniacid'=>$_SESSION['uniacid']),'title');
}else{
	$return['item']['group']='普通会员';
}
$user=pdo_get('jy_yiliao_user',array('mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']));
$user['mobile']=$user['mobile']?:$return['item']['mobile'];
$user['name']=$user['name']?:$return['item']['nickname'];
$user['birth']=json_decode($user['birth'],true);
$user['year']=$user['birth']['year']>0?date('Y')-$user['birth']['year']:'无';
$user['sex']=$user['sex']==1?'男':'女';
$return['user']=$user;
$setting=uni_setting('member_setting');
$return['registerset']=uni_setting('register');
$return['item']['barcode']='0-';
$return['item']['barcode'].=$_SESSION['uid']+10000000000000000;
$return['item']['sign']=$setting['sign']['open'];
$return['item']['tixians']=$setting['member']['tixians'];
$return['item']['cardbg']=$setting['cardbg'];
$member['ideal_money']=pdo_getcolumn('core_ideal_money',array('mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']),'money');
$return['item']['ideal_money']=$member['ideal_money']?$member['ideal_money']:'0.00';
$return['item']['mycoupon']=pdo_count('jy_weishop_coupon_getlog',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid'],'isuse'=>0),'id');
$wxcard_setting=uni_setting('wx_card_setting');
$wxcard_edit=uni_setting('wx_card_edit');
if($wxcard_edit['card_id'] && $wxcard_edit['status']==1 && $wxcard_setting['open']){
	//存在会员卡且允许领取微信会员卡，检查是否已领卡
	$check=pdo_getcolumn('core_fans',array('openid'=>$_SESSION['openid'],'uniacid'=>$_SESSION['uniacid'],'wxgid'=>$_SESSION['wechat_id']),'wxcard_code');
	if(!$check){
		$return['item']['wxcard']=1;
	}
}
$return['account']=$_SESSION['account'];
set_html('title','会员中心');
exi($return);